const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            page: {
                value1: '',
                PageNumber: 1, //页码
                RowAmount: 10,
                Condition: window.btoa(unescape(encodeURIComponent("%%,%%"))),
                ExtensionCondition: window.btoa(unescape(encodeURIComponent("AND volunteer_teams.Lead_Unit IN (" + getCookie('unit') + ")\r\n"))),
            },
            QR_code: false,
            currentActivity:{}
        }
    },
    mounted() {

    },
    methods: {
        handlexq(row) {
            this.currentActivity = row;
            this.QR_code = true;
            this.$nextTick(() => {
                const encodedSerial = encodeURIComponent(
                    row.Volunteer_Teams_Activities_SerialNumber
                );
                const url = `./particulars.html?serial=${encodedSerial}`;
                new QRious({
                    element: document.getElementById(
                        `qr-${row.Volunteer_Teams_Activities_SerialNumber}`
                    ),
                    value: url,
                    size: 200,
                });
            });
        },
        handleShow(row){
            window.location.href = './show.html?action=Add&Volunteer_Teams_Activities_SerialNumber=' + row.Volunteer_Teams_Activities_SerialNumber
        },
        handleZJ(row){
            window.location.href = './add1.html?action=Modify&nodeKey=' + row.Volunteer_Teams_Activities_SerialNumber
        },
        handleZJ1(row){
            window.location.href = './add1.html?action=Modify&type=1&nodeKey=' + row.Volunteer_Teams_Activities_SerialNumber
        },
        handleNews(row){
            window.location.href = '../../news_videos_files/news/add.html?action=Add&Party_Organization_Activity_SerialNumber=' + row.Volunteer_Teams_Activities_SerialNumber + "&News_Category_SerialNumber=NC0000000000050"
        },
        xinwenjilu(row){
            window.location.href = './news.html?nodeKey=' + row.Volunteer_Teams_Activities_SerialNumber
        },
        Treedata() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'volunteer_teams',
                    Condition: "Row_Status='0' AND volunteer_teams.Lead_Unit IN (" + getCookie('unit') + ")\r\n",
                },
                success: (data) => {
                    this.treeData = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                  },
                dataType: "json",
            });
        },
        check() {
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%%")));
            this.postgetList(this.page)
        },
        //树的点击筛选事件
        handleNodeClick(data, node) {
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + data.Volunteer_Team_SerialNumber + "%")));
            this.postgetList(this.page);
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
